# -*- coding: utf8 -*-
from google.appengine.dist import use_library
use_library('django', '1.0')

import logging
import wsgiref.handlers
from google.appengine.ext import webapp

from org.andolphin.m import LoginPage,RegisterPage, PayListPage, SyncVersionPage
from org.andolphin import AuthMiddleware,RestfulMethodMiddleware
from org.andolphin import MainPage

                                    

def main():
    logging.getLogger().setLevel(logging.DEBUG)

    application = webapp.WSGIApplication([(r'/', MainPage),
                                          (r'/m/login', LoginPage),
                                          (r'/m/paylist', PayListPage),
                                          (r'/m/sync_version', SyncVersionPage),
                                          (r'/m/register', RegisterPage)],
                                        debug=True)
    
    wsgiref.handlers.CGIHandler().run(AuthMiddleware(RestfulMethodMiddleware(application)))

if __name__ == "__main__":
    main()